Ubuntu 16.04
Sponsored Link

Limited shared directory
2016/05/20
 
Install Samba to share folders or files between Windows and Linux.
For example, Create a shared directory that requires user authentication.
[1] Install Samba.
root@smb:~#
apt-get -y install samba

[2] Configure Samba.
root@smb:~#
groupadd security

root@smb:~#
mkdir /home/security

root@smb:~#
chgrp security /home/security

root@smb:~#
chmod 770 /home/security

root@smb:~#
vi /etc/samba/smb.conf
# line 25: add

unix charset = UTF-8
# line 30: change (Windows' default)

workgroup =
WORKGROUP
# line 51: uncomment and change IP address you allow

interfaces = 127.0.0.0/8
10.0.0.0/24
# line 58: uncomment

bind interfaces only = yes
# add to the end

[Security]
# any name you like

   path = /home/security
   writable = yes
   create mode = 0770
   directory mode = 0770
   guest ok = no
# guest not allowed

   valid users = @security
# allow only security group's users
# add user in Samba

root@smb:~#
smbpasswd -a ubuntu

New SMB password:    
# set password

Retype new SMB password:
Added user ubuntu.
root@smb:~#
usermod -G security ubuntu

root@smb:~#
systemctl restart smbd

[3] Configure on Windows client. This example is on Windows 10.
Select [My Computer] - [Map Network Drive] like following example.
[4] Input '\\(server)\(shared directory)'
[5] Password is required. Input the one set in [1].
[6] Just accessed.
 
Tweet